package com.woniu.park.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniu.park.dao.UserMapper;
import com.woniu.park.entity.Comment;
import com.woniu.park.dao.CommentMapper;
import com.woniu.park.entity.User;
import com.woniu.park.service.ICommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cxb
 * @since 2020-09-08
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements ICommentService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private CommentMapper commentMapper;
    @Override
    public User findUserById(int commentUserId) {
        return userMapper.selectById(commentUserId);
    }

    @Override
    public List<Comment> findCommentByParkspaceId(int parkspaceId) {
        List<Comment> list = commentMapper.selectList(new QueryWrapper<Comment>().eq("comment_parkspace_id", parkspaceId));
        return list;
    }

    @Override
    public int findMaxTag() {

        return commentMapper.findMaxTag();
    }
}
